CC = g++
CFLAGS =-O3
LIBS = -lcrypto -lssl -lpthread 
INCLUDES=-I./lib/leveldb/include -I./chunking  -I./src -I./comm -I./encoding
MAIN_OBJS =./src/CryptoPrimitive.o ./chunking/chunking.o ./src/CDCodec.o ./comm/uploading.o ./encoding/encoding.o ./src/socket.o ./encoding/decoding.o ./comm/downloading.o

all:leveldb main

leveldb:
	make -C ./lib/leveldb

%.o: %.cc %.hh
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

main: ./main.cc $(MAIN_OBJS)
	$(CC) $(CFLAGS) -o main ./main.cc $(MAIN_OBJS) $(INCLUDES) ./lib/leveldb/libleveldb.a ./src/gf_complete.a $(LIBS)

clean:
	@rm -f main
	@rm -f $(MAIN_OBJS) 
